﻿@model GitCandy.Models.UserModel

@{
    ViewBag.Title = string.Format(SR.Shared_TitleFormat, string.Format(SR.Account_DetailTitle, Model.Name));
    var token = GitCandy.Security.Token.Current;
}
<h4>@string.Format(SR.Account_DetailTitle, Model.Name)</h4>

@if (Model != null)
{
    <div class="span8">
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Name)</div>
            <span class="span5 text-left lead">@Model.Name</span>
        </div>
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Nickname)</div>
            <span class="span5 text-left lead">@Model.Nickname</span>
        </div>
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Email)</div>
            <span class="span5 text-left lead">@Model.Email</span>
        </div>
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Respositories)</div>
            <span class="span5 text-left lead">@Html.DisplayFor(s => s.Respositories)</span>
        </div>
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Teams)</div>
            <span class="span5 text-left lead">@Html.DisplayFor(s => s.Teams)</span>
        </div>
        <div class="row">
            <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.Description)</div>
            <pre class="span5 text-left lead">@Model.Description</pre>
        </div>
        @if (token != null && token.IsSystemAdministrator)
        {
            <div class="row">
                <div class="span2 text-right lead muted">@Html.DisplayNameFor(s => s.IsSystemAdministrator)</div>
                <span class="span5 text-left lead">@Html.DisplayFor(s => s.IsSystemAdministrator)</span>
            </div>
        }
        @if (token != null && (token.Username == Model.Name || token.IsSystemAdministrator))
        {
            <div class="form-actions">
                <div class="pull-right">
                    @Html.ActionLink(SR.Account_ChangePassword, "Change", new { Model.Name })
                    @Html.ActionLink(SR.Shared_Edit, "Edit", new { Model.Name }, new { @class = "btn btn-primary" })
                </div>
            </div>
        }
    </div>
}
